flashcardfandomcom-20200213-history
Python
Links: Codecademy - Python Google's 2-Day Python Class Important Info 1. Each flashcard should be on a single line. 2. Use two vertical lines to separate the first side of the card from the second side: || 3. There is a third field after each card that is used by Anki to determine if the card should be double-sided. If there is anything written in that field, the card will be made double-sided. So if you don't want a card to be double-sided, leave that field blank. 4. I plan to make a Python program that will automatically scrape this page for the cards and put them into a format that Anki will accept. Codecademy - Python 1. Python Syntax ''1. Variables and Data Types 1/4 high-level language||this is a term used to describe a programming language that is easy to read and write. A language that looks a lot like regular English.||double-sided interpreted language||this is a term used to describe a language that avoids explicit program compilation. The __________ executes the program instructions (source code) directly, statement by statement. This can be contrasted with compiled language programs, which the user must explicitly translate into a lower-level machine language executable before running the program (like translating an email via Google Translate before sending it to someone who speaks a different language).||double-sided object-oriented language||This allows users to manipulate data structures called objects in order to build and execute programs||double-sided Where did the name "Python" come from?||The Python language was named after Monty Python, the English comedy group most famous for their movie "Monty Python and the Holy Grail".|| 2/4 What's a variable?||__________ is a word/identifier that hangs onto a single value. For example, let's say you needed the number 5 for your program, but you're not going to use it immediately. You can set __________ , say spam, to grab the value 5 and hang onto it for later use, like this: spam = 5||double-sided 3/4 What's a data type?||This is the term used to refer to the different kinds of information that a computer program can manipulate. For example, a program could manipulate individual letters, whole words, numbers with no fractional part, or numbers with fractional parts.||double-sided What's an integer?||This is the term used to refer to numbers with no fractional parts, like 3 or 61235 or 0 or -1231243.||double-sided What's a float?||This is the term used to refer to numbers with fractional parts, like 1.970.||double-sided What's a boolean?||This is the term used to refer to a variable that is always either "True" or "False".||double-sided Create an integer variable named "hey_now" and set it equal to the number three.||hey_now = 3|| Create a float variable named "bubba" and set it equal to 1.513||bubba = 1.513|| What's wrong with this code: my_bool = true||In Python, boolean values must be capitalized. It should be my_bool = True|| What's wrong with this code: my_bool = "True"||In Python, boolean values should not be contained in quotations marks; quotation marks are used for strings (text). It should be my_bool = True|| 4/4 You have a variable named my_int; its current value is 7. Reassign its value to 3.||my_int = 3|| 2. Whitespace and Statements 1/3 - What's a Statement? What's a statement?||You can think of a ________________ as being similar to a sentence in English: it's the smallest unit of the language that makes sense by itself. Just like "I," "like," and "Spam" aren't sentences by themselves, but "I like Spam" is, variables and data types aren't ________________ in Python, but they are the building blocks that form them.||double-sided What's whitespace?||The word used to refer to regular spaces (like when you hit the spacebar), tabs, and returns (when you hit "enter").||double-sided What's special about whitespace in Python?||Just as human languages have punctuation to distinguish one sentence from another, computer programs need a kind of punctuation to make it obvious where one statement ends and another begins. If you're familiar with JavaScript / Java / C / C++, you know that statements in those languages end with a semicolon (;). In Python, statements are separated by whitespace. Just like you can't toss around semicolons wherever you want in JS, you can't throw whitespace around in Python.||double-sided 2/3 - Whitespace Means Right Space IndentationError: expected an indented block||You'll get this error whenever your Python whitespace is out of whack. (If you've studied JavaScript, think of improper whitespace as improper use of ; or {}.) When your punctuation's off, your meaning can change entirely: The peasant said, "The witch turned me into a newt!" ; "The peasant," said the witch, "turned me into a newt!"||double-sided 3/3 - A Matter of Interpretation the interpreter||In the context of Codecademy, ____ is the console/output window in the top right corner of the page. For now, think of ____ as a program that takes the code you write, checks it for syntax errors, and executes the statements in that code, line by line. It works as a go-between for you and the computer and lets you know the result of your instructions to the machine.||double-sided 3. Comments 1/2 - Single Line Comments 2/2 - Multi-Line Comments 4. Math Operations'' 1/6 - Arithmetic Operators 2/6 - Subtraction 3/6 - Multiplication 4/6 - Division 5/6 - Exponentiation 6/6 - Modulo 2. Strings and Console Output ''1. Strings '' 1/4 - Step One: Strings 2/4 - Step Two: Things 3/4 - Step Three: Escape! 4/4 - Access by Offset 2. String Methods 1/5 - Four Methods to the Madness 2/5 - Lower 3/5 - Upper 4/5 - str() 5/5 - Dot Notation ''3. Print '' 1/2 - Printing with String Literals 2/2 - Printing with Variables ''4. Advanced Printing '' 1/4 - String Concatenation 2/4 - Explicit String Conversion 3/4 - String Formatting with %, Part 1 4/4 - String Formatting with %, Part 2 ''5. Review '' 1/1 - And Now For Something Completely Familiar 3. Conditionals and Control Flow 4. Functions 5. Lists & Dictionaries 6. Student Becomes the Teacher 7. Lists and Functions 8. Loops 9. Exam Statistics 10. Advanced Topics in Python 11. Introduction to Classes 12. File Input and Output Google Python Class Write the second section of your page here.